#include "bsp_exit.h"
#include "bsp_delay.h"
#include "bsp_led.h"
#include "bsp_beep.h"
#include "bsp_uart1.h"
#include "bsp_gpt.h"
#include "stdio.h"

static void gpt_handler(uint32_t nirq, void* args)
{
    static int led_status = OFF;
    if (GPT2->SR & 1)
    {
        led_switch(0, led_status);
        led_status = !led_status;
    }
    GPT2->SR |= 1 << 0;
}
void test_main_uart1()
{
    led_init();
    beep_init();
    uart_1_init(115200);
    gpt_init(GPT2,0, 66000000 / 5);
    gpt_irq_init(GPT2, GPT2_IRQn, gpt_handler, NULL);
    beep_switch(ON);
    delay(500);
    beep_switch(OFF);
    // char c;
    while (1)
    {
        putc(getc());
        printf("val = %d\n", 100);
    }
}